{include file="public_iframe:head"}
<style>
    .modal-backdrop.in{
        opacity:0 !important;
        z-index: -1 !important;
    }

    .note-editable{
        height: 200px;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>修改联系方式</h5>
                </div>
                <div class="ibox-content">
                    <form action="" method="post" class="form-horizontal" enctype="multipart/form-data">

                        <div class="form-group">
                            <label class="col-sm-2 control-label">{$weixin.name}</label>
                            <div class="col-sm-10">
                                <input type="hidden" name="weixin_id" value="{$weixin.id}">
                                <input type="text" class="form-control" name="weixin" value="{$weixin.value}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">{$phone.name}</label>
                            <div class="col-sm-10">
                                <input type="hidden" name="phone_id" value="{$phone.id}">
                                <input type="text" class="form-control" name="phone" value="{$phone.value}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">{$regKnow.name}</label>
                            <input type="hidden" name="reg_know_id" value="{$regKnow.id}">
                            <script id="reg_know" name="reg_know" type="text/plain" style="width: 800px;height:350px;margin-left: 288px;margin-top: 0px;">{$regKnow.value}</script>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">{$help.name}</label>
                            <input type="hidden" name="help_id" value="{$help.id}">
                            <script id="help" name="help" type="text/plain" style="width: 800px;height:350px;margin-left: 288px;margin-top: 0px;">{$help.value}</script>
                            <!-- <input type="hidden" id="contract" name="contract" value="">
                            <div class="col-sm-10">
                                <div class="summernote1">{$contract.value}</div>
                            </div> -->
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">{$contract.name}</label>
                            <input type="hidden" name="contract_id" value="{$contract.id}">
                            <script id="contract" name="contract" type="text/plain" style="width: 800px;height:350px;margin-left: 288px;margin-top: 0px;">{$contract.value}</script>
                            <!-- <input type="hidden" id="contract" name="contract" value="">
                            <div class="col-sm-10">
                                <div class="summernote1">{$contract.value}</div>
                            </div> -->
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">{$notice.name}</label>
                            <input type="hidden" name="notice_id" value="{$notice.id}">
                            <script id="notice" name="notice" type="text/plain" style="width: 800px;height:350px;margin-left: 288px;margin-top: 0px;">{$notice.value}</script>
                            <!-- <input type="hidden" id="notice" name="notice" value="">
                            <div class="col-sm-10">
                                <div class="summernote2" style="height: 1220px">{$notice.value}</div>
                            </div> -->
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">{$pay_img.name}</label>
                            <div class="col-sm-10">
                            <input type="hidden" name="pay_img_id" value="{$pay_img.id}">
                            <input type="file" name="file" class="form-control file" style="padding:4px 12px">
                            <img src="{$img_path}{$pay_img.value}" width="150" height="150">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">{$wx_pay_img.name}</label>
                            <div class="col-sm-10">
                            <input type="hidden" name="wx_pay_img" value="{$wx_pay_img.id}">
                            <input type="file" name="file_type" class="form-control file" style="padding:4px 12px">
                            <img src="{$img_path}{$wx_pay_img.value}" width="150" height="150">
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" id="submit" type="submit">立即修改</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">

    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    var reg_know = UE.getEditor('reg_know');
    var contract = UE.getEditor('contract');
    var notice = UE.getEditor('notice');
    var help = UE.getEditor('help');
</script>
<script type="text/javascript">

    $('#submit').click(function(){
        var weixin_id = $('input[name="weixin_id"]').val();
        var weixin = $('input[name="weixin"]').val();

        var phone_id = $('input[name="phone_id"]').val();
        var phone = $('input[name="phone"]').val();

        var reg_know_id = $('input[name="reg_know_id"]').val();
        var reg_know_c = reg_know.getContent();

        var contract_id = $('input[name="contract_id"]').val();
        var contract_c = contract.getContent();

        var notice_id = $('input[name="notice_id"]').val();
        var notice_c = notice.getContent();

        var help_id = $('input[name="help_id"]').val();
        var help_c = help.getContent();

        var pay_img_id = $('input[name="pay_img_id"]').val();
        var file = $('input[name="file"]')[0].files[0];

        var wx_pay_img = $('input[name="wx_pay_img"]').val();
        var file_pay = $('input[name="file_type"]')[0].files[0];
            
        var formData = new FormData();
        formData.append('weixin_id',weixin_id);
        formData.append('help_id',help_id);
        formData.append('help_c',help_c);
        formData.append('weixin',weixin);
        formData.append('phone_id',phone_id);
        formData.append('phone',phone);
        formData.append('reg_know_id',reg_know_id);
        formData.append('reg_know',reg_know_c);
        formData.append('contract_id',contract_id);
        formData.append('contract',contract_c);
        formData.append('notice_id',notice_id);
        formData.append('notice',notice_c);
        formData.append('file_img',file);
        formData.append('pay_img_id',pay_img_id);
        formData.append('file_pay',file_pay);
        formData.append('wx_pay_img',wx_pay_img);

        $.ajax({
            url:"{:url('Set/doEdit')}",
            type:'POST',
            data:formData,
            async:false,
            processData:false,
            contentType:false,
            success:function(result){
                location.href = result.url;
            }

        });

        return false;
    });
</script>
</html>
